<HTML><HEAD> <!-- --------------- Marquee Message --------------- --> <SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers /* THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com Copyright (c)2000 by Charles River Media. All Rights Reserved. This applet can only be re-used or modifed by license holders of the JavaScript Cookbook CD-ROM. Credit must be given in the source code and this copyright notice must be maintained. If you do not hold a license to the JavaScript Cookbook, you may NOT duplicate or modify this code for your own use. Use at your own risk. No warranty is given or implied of the suitability of this applet for any specific application. Neither Erica Sadun nor Charles River Media will be held responsible for any unwanted effects due to the use of this applet or any derivative. */ var str="" // the string to display var direction="left" function setMessage() { msg = "YOUR MESSAGE HERE" /* initialize the string to a bit from the left */ if (str == "") str = " "+msg if (str.length < 20) // leftmost: swing to the right { direction = "right" str = " " + str } else if (str.length > 110) // rightmost: swing to the left { direction = "left" str = str.substring(3, str.length) } else if (direction == "left") // nudge left -- make shorter { str = str.substring(2, str.length) } else // nudge right -- make longer { str = " "+str } // Update the Status Bar and set the new timeout window.status = str JSCTimeOutID = window.setTimeout('setMessage()',100) } <!-- done hiding --></SCRIPT></HEAD> <BODY bgcolor="ffffff" link="0000ff" vlink="770077" onload="JSCTimeOutID = window.setTimeout('setMessage()',500);"> <FONT COLOR="007777"><H1><IMG SRC="../GRAFX/UTENS.JPG" WIDTH=80 HEIGHT=50 ALIGN = LEFT>Marquee #2</H1></FONT> <BLOCKQUOTE><FONT COLOR="770000"> This script scrolls a message from right to left and left to right, using the substr function to cut the message smaller and smaller and string addition to make the message larger and larger. Watch the messages bounce back and forth. </FONT></BLOCKQUOTE> <BR><BR> <FONT COLOR="007777"><H2>Discussion</H2></FONT> <FONT SIZE=4> Like previous scripts, this JavaScript sets an initial timeout in the BODY that is renewed in a function call. Since the rightward scroll is slower than the leftward scroll, the string increases in size by two going right and decreases in size by one going left. </FONT> <h5>Copyright ©1996 by Charles River Media, All Rights Reserved</h5> </BODY> </HTML>